<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			ul,li{
				list-style: none;
				}
		</style>
	</head>
	<body>
		
		<div id="box">
			
			<ul>
				<!-- <li>用户名;<input type="text" name="username"/></li>
				<li>密码：<input type="password" name="password" /></li>
				<li>性别：<select name="gender">
					<option value="男">男</option>
					<option value="女">女</option>
					<option value="不男">不男</option>
					<option value="不女">不女</option>
					<option value="Gay">Gay</option>
					<option value="妖王">妖王</option>
				</select></li>
				<li>爱好：
				<input type="checkbox" name="hobby" id="" value="篮球"/>篮球
				<input type="checkbox" name="hobby" id="" value="篮球"/>篮球
				<input type="checkbox" name="hobby" id="" value="篮球"/>篮球
				<input type="checkbox" name="hobby" id="" value="篮球"/>篮球
				<input type="checkbox" name="hobby" id="" value="篮球"/>篮球
				<input type="checkbox" name="hobby" id="" value="篮球"/>篮球
				</li>
				<li>是否已婚：
				<input type="radio" name="married" id="" value="已婚" />已婚
				<input type="radio" name="married" id="" value="未婚" />已婚
				</li>
				<li>简介<textarea rows="" cols="">
					
				</textarea></li> -->
			</ul>
			
		</div>
		<script type="text/javascript">
			var arr = [{

					label: "用户名",

					name: "username",

					type: "text"

				}, {

					label: "密码",

					name: "password",

					type: "password"

				}, {

					label: "性别",

					name: "gender",

					type: "select",

					value: ['男', '女', '不男', '不女', 'Gay', '妖王']

				}, {

					label: "爱好",

					name: "hobby",

					type: "checkbox",

					value: ['篮球', '足球', '羽毛球', '兵乓球', '爬山', '购物', '旅游', '看美女']

				}, {

					label: '是否已婚',

					name: 'married',

					type: 'radio',

					value: ['已婚', '未婚']

				},
				{

					label: '简介',

					name: 'resume',

					type: 'textarea'

				}
			];
			
			arr.forEach(function(item,index){
				box.innerHTML +='<ul>'+
				'<li>'+item.label+'<input name="'+item.name+'"  type="'+item.type+'" />'+
				'</li>'+
			'</ul>'
				if(item[index]===2){
					ul.innerHTML +='<li>'+item.label+'<select name="gender">'+
					'<option value="男">'+item.value[0]+'</option>'+
					'<option value="女">'+item.value[1]+'</option>'+
					'<option value="不男">'+item.value[2]+'</option>'+
					'<option value="不女">'+item.value[3]+'</option>'+
					'<option value="Gay">'+item.value[4]+'</option>'+
					'<option value="妖王">'+item.value[5]+'</option>'+
				'</select>'+
				'</li>'
				}
				
			})
		</script>
	</body>
</html>
